package com.ws.universal.tools.takephoto.model;

import java.io.Serializable;

/**
 * 裁剪配置类
 * Author: JPH
 * Date: 2016/7/27 13:19
 */
public class CropOptions implements Serializable {
    /**
     * 使用TakePhoto自带的裁切工具进行裁切
     */
    private boolean withOwnCrop;
    private boolean isChangeCropSize;
    private int aspectX;
    private int aspectY;

    private CropOptions() {
    }

    @Override
    public String toString() {
        return "CropOptions{" + "withOwnCrop=" + withOwnCrop + ", isChangeCropSize=" + isChangeCropSize + ", aspectX=" + aspectX + ", aspectY=" + aspectY + '}';
    }

    public int getAspectX() {
        return aspectX;
    }

    public void setAspectX(int aspectX) {
        this.aspectX = aspectX;
    }

    public int getAspectY() {
        return aspectY;
    }

    public void setAspectY(int aspectY) {
        this.aspectY = aspectY;
    }

    public boolean isWithOwnCrop() {
        return withOwnCrop;
    }

    public void setWithOwnCrop(boolean withOwnCrop) {
        this.withOwnCrop = withOwnCrop;
    }

    public boolean isChangeCropSize() {
        return isChangeCropSize;
    }

    public void setChangeCropSize(boolean changeCropSize) {
        isChangeCropSize = changeCropSize;
    }

    public static class Builder {
        private CropOptions options;

        public Builder() {
            options = new CropOptions();
        }

        public Builder setAspectX(int aspectX) {
            options.setAspectX(aspectX);
            return this;
        }

        public Builder setAspectY(int aspectY) {
            options.setAspectY(aspectY);
            return this;
        }

        /**
         * 裁剪工具
         *
         * @param withOwnCrop false  系统裁剪 true takePhoto自带裁剪
         * @return
         */
        public Builder setWithOwnCrop(boolean withOwnCrop) {
            options.setWithOwnCrop(withOwnCrop);
            return this;
        }

        /**
         * 是否允许改变裁剪大小
         *
         * @param isChangeCropSize
         * @return
         */
        public Builder setChangeCropSize(boolean isChangeCropSize) {
            options.setChangeCropSize(isChangeCropSize);
            return this;
        }

        public CropOptions create() {
            return options;
        }
    }
}
